<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h:form id="form" enctype="multipart/form-data">
                <br/>
                <h2 class="title">Relatório por bairro</h2>
                <p:growl id="messages" showDetail="false" autoUpdate="true"  /> 
                <br/>
                <p:panel id="cessaoPanel" styleClass="container_24 clearfix">

                    <p:panel id="addressPanel" styleClass="container_24 clearfix">

                        <h4 class="title">Endereço</h4>

                        <p:outputLabel value="Bairro" styleClass="grid_3" for="bairroInputText" />
                        <p:autoComplete id="bairroInputText" styleClass="grid_19"  dropdown="true" converter="bairroconverter"   
                                        var="bairro" itemLabel="#{bairro.nome}" multiple="true" itemValue="#{bairro}"
                                        scrollHeight="200" forceSelection="true"
                                        completeMethod="#{managerRelatorioBairro.autocompleteMultipleBairro}">
                            <p:ajax event="itemSelect" listener="#{managerRelatorioBairro.adicionarBairroSelecionado}" process="@this"/>
                            <p:ajax event="itemUnselect" listener="#{managerRelatorioBairro.removerBairroSelecionado}" process="@this"/>
                        </p:autoComplete>

                    </p:panel>

                    <br/>
                    <div class="buttonAction">

                        <p:commandButton id="imprimirCommandButton" ajax="false" update="@form" 
                                         widgetVar="imprimir" value="Imprimir" icon="ui-icon-print"
                                         onclick="this.form.target='_blank'"
                                         actionListener="#{managerRelatorioBairro.imprimirRelatorioPorBairro()}"/>

                        <p:commandButton  rendered="false" value="Limpar"
                                          title="Limpar" icon="ui-icon-clean" update="@form"
                                          actionListener="#{managerRelatorioBairro.init()}"/>
                    </div>
                    <br/><br/>
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>
</html>
